<?php

/**
 * LigneFactureClient filter form base class.
 *
 * @package    SdCommerce
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseLigneFactureClientFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'designation'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'taux_remise'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'quantite_livre'     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'quantite'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'quantite_rendue'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'poids_net'          => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'poids_brut'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'prix_unitaire_ht'   => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'prix_total_ht'      => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'prix_total_tttc'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'prix_total_ttcnet'  => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'prix_tva'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'stock_article_id'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('StockArticle'), 'add_empty' => true)),
      'article_serieid'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('ArticleSerie'), 'add_empty' => true)),
      'facture_client_id'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('FactureClient'), 'add_empty' => true)),
      'tva_id'             => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Tva'), 'add_empty' => true)),
      'maintenance_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Maintenance'), 'add_empty' => true)),
      'departement_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Departement'), 'add_empty' => true)),
      'unite_logistiqueid' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('UniteLogistique'), 'add_empty' => true)),
      'r'                  => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'q'                  => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'deleted_at'         => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'created_at'         => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'         => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'designation'        => new sfValidatorPass(array('required' => false)),
      'taux_remise'        => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'quantite_livre'     => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'quantite'           => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'quantite_rendue'    => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'poids_net'          => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'poids_brut'         => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'prix_unitaire_ht'   => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'prix_total_ht'      => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'prix_total_tttc'    => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'prix_total_ttcnet'  => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'prix_tva'           => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'stock_article_id'   => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('StockArticle'), 'column' => 'id')),
      'article_serieid'    => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('ArticleSerie'), 'column' => 'id')),
      'facture_client_id'  => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('FactureClient'), 'column' => 'id')),
      'tva_id'             => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Tva'), 'column' => 'id')),
      'maintenance_id'     => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Maintenance'), 'column' => 'id')),
      'departement_id'     => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Departement'), 'column' => 'id')),
      'unite_logistiqueid' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('UniteLogistique'), 'column' => 'id')),
      'r'                  => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'q'                  => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'deleted_at'         => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'created_at'         => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'         => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('ligne_facture_client_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'LigneFactureClient';
  }

  public function getFields()
  {
    return array(
      'id'                 => 'Number',
      'designation'        => 'Text',
      'taux_remise'        => 'Number',
      'quantite_livre'     => 'Number',
      'quantite'           => 'Number',
      'quantite_rendue'    => 'Number',
      'poids_net'          => 'Number',
      'poids_brut'         => 'Number',
      'prix_unitaire_ht'   => 'Number',
      'prix_total_ht'      => 'Number',
      'prix_total_tttc'    => 'Number',
      'prix_total_ttcnet'  => 'Number',
      'prix_tva'           => 'Number',
      'stock_article_id'   => 'ForeignKey',
      'article_serieid'    => 'ForeignKey',
      'facture_client_id'  => 'ForeignKey',
      'tva_id'             => 'ForeignKey',
      'maintenance_id'     => 'ForeignKey',
      'departement_id'     => 'ForeignKey',
      'unite_logistiqueid' => 'ForeignKey',
      'r'                  => 'Number',
      'q'                  => 'Number',
      'deleted_at'         => 'Date',
      'created_at'         => 'Date',
      'updated_at'         => 'Date',
    );
  }
}
